﻿<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <script type="text/javascript" src="https://www.funbling.net/Public/static/jquery-2.0.3.min.js"></script>
    <title></title>
    <style>
        * {
            margin: 0;
            padding: 0;
            width: 99.99%;
        }

        ul li {
            list-style: none;
        }

        li {
            border-bottom: 1px solid #f6f6f6;
        }

        .header {
            width: 100%;
            height: 1rem;
            line-height: 1rem;
            text-align: center;
            position: relative;
            border-bottom: 1px solid #f6f6f6;
        }

        .header .back {
            width: 0.2rem;
            height: 0.38rem;
            position: absolute;
            top: 0.31rem;
            left: 0.25rem;
        }

        .code {
            width: 90%;
            padding: 0 5%;
        }

        .order_details {
            width: 100%;
            display: flex;
            height: 1.2rem;
            margin: 0.3rem 0;

        }

        .order_img {
            width: 1.6rem;
            height: 1.16rem;
            border: 0.02rem #EAEAEA solid;
            margin-right: 0.2rem;
        }

        .order_p {
            flex: 1;
            height: 1.2rem;
            line-height: 0.6rem;
            font-size: 0.32rem;
            color: #333;
        }

        .order_p2 {
            font-size: 0.28rem;
            color: #999;
        }
        .gt {
            height: 1.2rem;
            line-height: 1.2rem;
            width: 0.2rem;
        }
        .order_more {
            width: 100%;
            text-align: center;
            height: 1rem;
            line-height: 1rem;
            color: #999;
            font-size: 0.28rem;
        }
    </style>
    <script>
        (function (designWidth, maxWidth) {
            var doc = document,
                win = window,
                docEl = doc.documentElement,
                remStyle = document.createElement("style"),
                tid;

            function refreshRem() {
                var width = docEl.getBoundingClientRect().width;
                maxWidth = maxWidth || 540;
                width > maxWidth && (width = maxWidth);
                var rem = width * 100 / designWidth;
                remStyle.innerHTML = 'html{font-size:' + rem + 'px;}';
            }
            if (docEl.firstElementChild) {
                docEl.firstElementChild.appendChild(remStyle);
            } else {
                var wrap = doc.createElement("div");
                wrap.appendChild(remStyle);
                doc.write(wrap.innerHTML);
                wrap = null;
            }
            refreshRem();
            win.addEventListener("resize", function () {
                clearTimeout(tid)
                tid = setTimeout(refreshRem, 300);
            }, false);
            win.addEventListener("pageshow", function (e) {
                if (e.persisted) {
                    clearTimeout(tid);
                    tid = setTimeout(refreshRem, 300);
                }
            }, false);
            if (doc.readyState === "complete") {
                doc.body.style.fontSize = "16px";
            } else {
                doc.addEventListener("DOMContentLoaded", function (e) {
                    doc.body.style.fontSize = "16px";
                }, false);
            }
        })(750, 750);
    </script>
</head>

<body>
    <header class="header">
        <a href="BlingShoping.html">
            <img class="back" src="images/back.png" alt="">
        </a>
        <p class="title">兑换记录</p>
    </header>

    <ul class="code">
        <!-- <li>
            <div class="order_details">
                <p class="order_img"><img style="width:100%;height:100%;" src="images/2.png" /></p>
                <div class="order_p">
                    <p>房比邻周边定制衣服</p>
                    <p class="order_p2">兑换成功</p>
                </div>
                <p class="gt"><img style="width:0.14rem;height:0.26rem;" src="images/join.png" /></p>
            </div>
        </li> -->
    </ul>
    <p class="order_more">已经没有更多了！</p>
    <script>
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg); //匹配目标参数
            if (r != null) return unescape(r[2]);
            return null; //返回参数值
        }

        var start = getUrlParam('start');
        var data_id = {};
        var url = 'http://192.168.1.44/shop/Shop/orderRecord';
        if (start) {
            data_id = {
                customer_id: localStorage.getItem("customer_id")
            };
            url = 'http://192.168.1.44/shop/Shop/orderRecord2';
        }
        $.ajax({
            url: 'http://192.168.1.44/shop/Shop/orderRecord',
            type: "get",
            data: data_id,
            success: function (data) {
                var datas = JSON.parse(data);
                localStorage.setItem("customer_id", datas.data.customer_id);
                console.log(datas);
                var html = '';
                $.each(datas.data.list, function (i, e) {
                    var arr = e.status;
                    switch (arr) {
                        case "0":
                            arr = '待支付'
                            break;
                        case "1":
                            arr = '待发货'
                            break;
                        case "2":
                            arr = '已发货'
                            break;
                        case "3":
                            arr = '用户确认收货'
                            break;
                        case "4":
                            arr = '系统默认收货'
                            break;
                        case "5":
                            arr = '已关闭'
                            break;
                        case "6":
                            arr = '兑换成功'
                            break;
                    }


                    html += '<li data-id=' + e.order_id + '><div class="order_details">' +
                        '<p class="order_img"><img style="width:100%;height:100%;" src="' + e.img +
                        '" /></p>' +
                        '<div class="order_p">' +
                        '<p>' + e.goods_title + e.goods_attr + '</p>' +
                        '<p class="order_p2">' + arr + '</p>' +
                        '</div>' +
                        '<p class="gt"><img style="width:0.14rem;height:0.26rem;" src="images/join.png" /></p>' +
                        '</div>' +
                        '</li>' +
                        '</li>';
                })
                $('.code').html(html);
            }
        })
        $('.code').on('click', 'li', function () {
            var order_id = $(this).attr('data-id');
            localStorage.setItem('orderId', order_id);
            $(location).attr("href", "OrderDetails.html");
        })
    </script>

</html>